/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Controller;

import java.awt.Image;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;

/**
 *
 * @author USUARIO
 */
public class GetGoogleMap {
    public Image GetMap(String coorY, String coorX, String zoom){
        Image image = null;
        try {
            URL url = new URL("http://maps.google.com/maps/api/staticmap?center=" + coorX + "," + coorY + "&zoom=" + zoom + "&maptype=satellite&size=300x300&sensor=false&format=jpg");
            image = ImageIO.read(url);
            return image;
        } catch (IOException ex) {
            System.out.println("No se pudo class getMap");
        }
        
        try {
            image = ImageIO.read(new File("error.jpg"));
        } catch (IOException ex) {
            Logger.getLogger(GetGoogleMap.class.getName()).log(Level.SEVERE, null, ex);
        }
        return image;
    }
}
